#ifndef PARTICIPANTSHEET_H
#define PARTICIPANTSHEET_H

#include <QObject>
#include "participant.h"

/*
  class ParticipantSheet
  ----------------------
  A participant sheet is the registration list for the race, and
  contains a list of participants.
*/

class ParticipantSheet : public QObject
{
    Q_OBJECT

public:
    ParticipantSheet();

public:

    ParticipantSheet(QObject* parent);
    virtual ~ParticipantSheet();

    void                 addParticipant(Participant* participant);
    void                 insertParticipant(int row, Participant* participant);
    void                 changeParticipant(int row, Participant* participant);
    void                 removeParticipant(int row);
    void                 moveParticipantUp(int row);
    void                 moveParticipantDown(int row);

    Participant*         getParticipant(int row);
    Participant*         getLastParticipant();

    int                  nextParticipantPosition() { return mParticipants.size() + 1; }

    void                 saveFile(const QString& fileName);
    QList<Participant*>  shownParticipants();

signals:
    void                 participantsChanged();

private:

    int                  mRecordCount;
    QList<Participant*>  mParticipants;

};

#endif // PARTICIPANTSHEET_H
